package de.gbeine.java.depview.ui.controller;

import com.google.common.eventbus.Subscribe;

import de.gbeine.java.depview.event.AddFilterEvent;

/**
 *
 * @author gbeine
 *
 */
public final class FilterPanelController {

    /**
     *
     */
    private final FilterPanel filterPanel;

    /**
     *
     * @param pFilterPanel
     */
    public FilterPanelController(final FilterPanel pFilterPanel) {
        super();
        this.filterPanel = pFilterPanel;
    }

    /**
     *
     * @param pAddFilterEvent
     */
    @Subscribe
    public void onAddFilterEvent(final AddFilterEvent pAddFilterEvent) {
        if (pAddFilterEvent.triggeredFrom(this.filterPanel)) {
            return;
        }
        this.filterPanel.addFilter(pAddFilterEvent.getFilter());
    }

}
